package com.wxh.producerconsumer.synchronizedmethod;

/**
 * @ClassName: ProducerThread
 * @Description:
 * @Author wxh
 * @Date: 2021/12/7 10:44
 * @Version V1.0.0
 * @Since 1.8
 */
public class ProducerThread extends Thread {

    private Shop shop;

    public ProducerThread(Shop shop){
        this.shop = shop;
    }

    @Override
    public void run() {
        System.out.println(getName() + ":开始生产面包.....");
        while (true){
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            // 生产面包
            shop.producerBread();
        }
    }
}
